package com.xayy.health.core.enums;

import lombok.Getter;

/**
 * 异常等级枚举
 *
 * @author houchengwei
 * createTime 2023/2/20
 * @version V1.0
 */
public enum FaultLevelEnum {
    //轻微
    MILD(1, "轻微"),
    //一般
    MODERATE(2, "一般"),
    //严重
    SEVERE(3, "严重"),
    //致命
    FATAL(4, "致命");

    @Getter
    private Integer code;

    @Getter
    private String name;

    FaultLevelEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String valueof(Integer index) {
        for (FaultLevelEnum relationTypeEnum : values()) {
            if (relationTypeEnum.getCode().equals(index)) {
                return relationTypeEnum.name;
            }
        }
        return "";
    }
}
